package book;

public class BookList {
    private Book[] books = new Book[10];

    private int usedSize;//记录当前有多少本书

    public BookList(){
        books[0] = new Book("三国演义","罗贯中",19,"小说" );
        books[1] = new Book("西游记","吴承恩",15,"小说" );
        books[2] = new Book("红楼梦","曹雪芹",25,"小说" );
        usedSize = 3;
    }

    /**
     * 得到书
     * @param pos 此时pos位置一定要合法
     * @return 这是一本书
     */
    public Book getBook(int pos){
        return books[pos];
    }

    /**
     * 放入图书
     * @param pos pos位置一定要合法
     * @param book 要放入的书
     */
    public void setBook(int pos,Book book){
        books[pos] = book;
    }

    /**
     * 实时获取当前书的个数
     * @return
     */
    public int getUsedSize(){
        return usedSize;
    }

    /**
     * 实时修改当前书架书的个数
     * @param size
     */
    public void setUsedSize(int size){
        usedSize = size;
    }

}
